<?php
//ignore_user_abort();
set_time_limit(0);
include("yinyuetai.php");

class User extends YYT
{
    public function getUserUrl()
    {
          for($i=1;$i<150000;$i++): 
                $user_home_url = 'http://www.yinyuetai.com/u/'.$i;
                $this->fetch($user_home_url);

                $doc = new DOMDocument();
               @$doc->loadHTML($this->results);
                $xPath = new DOMXPath($doc);

                $user_name = $xPath ->query("//div[@class='user_info_box detailbox']/h4/text()");
                $user_name = $this->data_process($user_name->item(0)->nodeValue);
            
             //  if(empty($user_name)): echo $user_home_url;$i++  endif;
               if(!empty($user_name)):

                $user = $xPath->query("//span[@class='headpic']/a/img/attribute::src");
                $user_avatar = $user->item(0)->nodeValue;
                $path = '/var/www/cj/yyt/upload/avatar';  
                $user_home_id = $i;
                $this->downloadImg($user_avatar,$user_home_id,$path);

                $sql = "insert into yyt_user_info (`user_name`,`user_home_id`)
                        values ('$user_name','$i') 
                        ON DUPLICATE KEY UPDATE user_name = '$user_name'";     
                $this->db->exec($sql);
                endif;
           endfor;
    }

    function __construct()
    {
        $this->con();
        $this->getUserUrl();
        echo date('y-m-d H:i:s') . "\n<br />";
    }

}

$user = new User();








?>
